﻿package mortal.game.view.mining.render
{
    import com.mui.controls.*;
    import com.mui.core.*;
    import mortal.common.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;

    public class MiningStar extends GSprite
    {
        private var _bmps:Array;
        private var _startX:int = 0;
        private var _url:String;
        public var isCenter:Boolean = true;

        public function MiningStar()
        {
            this._bmps = [];
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            DisplayUtil.delNotUse(this._bmps, 0);
            this.isCenter = true;
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._bmps = [];
            return;
        }// end function

        public function updateStars(param1:int, param2:int) : void
        {
            var _loc_4:GBitmap = null;
            this._startX = -param2 * 11;
            if (!this.isCenter)
            {
                this._startX = 0;
            }
            this._url = this.getUrlByColor(param1);
            var _loc_3:int = 0;
            while (_loc_3 < param2)
            {
                
                _loc_4 = this.getBmp(_loc_3);
                _loc_4.x = _loc_3 * 14 + this._startX;
                _loc_4.y = 0;
                _loc_3++;
            }
            DisplayUtil.delNotUse(this._bmps, param2);
            return;
        }// end function

        private function getBmp(param1:int) : GBitmap
        {
            var _loc_2:* = this._bmps[param1];
            if (_loc_2 == null)
            {
                _loc_2 = UIFactory.gBitmap(this._url, 0, 0, this);
                this._bmps.push(_loc_2);
            }
            _loc_2.bitmapData = GlobalClass.getBitmapData(this._url);
            return _loc_2;
        }// end function

        private function getUrlByColor(param1:int) : String
        {
            return ImagesConst.Mining_yellowStar;
        }// end function

    }
}
